<template>
  <div class="ele-header">
    <div class="ele-modify"></div>
    <div class="ele-header-top">
      <div class="ele-header-img">
        <img src="../../assets/seller_avatar_256px.jpg" />
      </div>
      <div class="ele-header-content">
        <div class="ele-title">
          <span class="ele-brand">
          </span>
          <span class="ele-name">{{ seller.name }}</span>
        </div>
        <div class="ele-desc">
          {{ seller.description }}/{{ seller.deliveryTime }}分钟送达
        </div>
        <div class="ele-discount" v-if="seller.supports">
          <span class="ele-icon-re">
            <img src="../../assets/img/decrease_1@2x.png" />
          </span>
          <span class="ele-discount-text">
            {{ seller.supports[0].description }}
          </span>
          <span class="ele-discount-button" @click="handlerChange">
            {{ seller.supports.length }}个<span class="iconfont eleic_right openInfo"></span>
          </span>
        </div>
      </div>
    </div>
<!--    公告-->
    <div class="ele-header-notice" @click="handlerChange">
      <span class="ele-notice-title"> </span>
      <span class="ele-notice-text">{{ seller.bulletin }}</span>
      <span class="ele-notice-button iconfont eleic_right"></span>
    </div>
<!--    遮罩层-->
    <transition name="model">
        <div class="ele-header-info-model" v-show="visibility">
      <div class="ele-info-content">
        <div class="ele-info-title">
            {{seller.name}}
        </div>
        <div class="ele-info-stars">

              <ele-stars :score="seller.score"></ele-stars>

        </div>
        <div class="ele-info-divider">
            <span class="ele-model-text">优惠信息</span>
        </div>
        <div class="ele-info-desc">
          <div class="ele-info-container">
           <ele-discount v-for="Item in seller.supports" :discountInfo="Item"></ele-discount>
          </div>
        </div>
        <div class="ele-info-divider">
          <span class="ele-model-text">商家公告</span>
        </div>
        <div class="ele-seller-notice">{{seller.bulletin}}</div>
      </div>
<!--      关闭按钮-->
      <div class="ele-info-closed">
        <span class="ele-info-button iconfont eleguanbi" @click="handlerChange"></span>
      </div>
    </div >
      </transition>
  </div>
</template>

<script>
  import eleStars from "../stars"
  import eleDiscount from "../discount_info"
export default {
    data(){
      return {
        visibility:false
      }
    },
  props: {
    seller: {},
  },
  components:{
    eleStars,
    eleDiscount
  },
  methods:{
    handlerChange(){
        this.visibility = !this.visibility
    }
  },
  computed: {
  },
};
</script>

<style scoped>
.openInfo{
  font-size: 8px;
}
.ele-header {
  position: relative;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.6);
  background-size: cover;
  background-repeat: no-repeat;
}
.ele-modify {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-image: url("../../assets/seller_avatar_256px.jpg");
  background-size: 100% 100%;
  filter: blur(10px);
  z-index: -1;
}
.ele-header-top {
  margin: 24px 12px 18px 24px;
  display: flex;
}
.ele-name {
  vertical-align: bottom;
  margin-left: 6px;
  font-weight: 200;
}
.ele-header-img {
  vertical-align: bottom;
  height: 64px;
  width: 64px;
  border-radius: 2px;
  overflow: hidden;
}
.ele-header-img img {
  height: 100%;
  width: 100%;
}
.ele-header-content {
  margin: 0 12px 0 16px;
  padding-top: 2px;
  flex: 1;
}
.ele-brand {
  display: inline-block;
  vertical-align: top;
  height: 18px;
  width: 30px;
  background-image: url("../../assets/img/brand@2x.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.ele-name {
  font-size: 16px;
  color: rgba(255, 255, 255, 1);
  font-weight: bold;
  line-height: 16px;
}
.ele-desc {
  color: #fff;
  margin: 8px 0 10px 0;
  font-size: 12px;
  line-height: 12px;
}
.ele-discount {
  position: relative;
  width: 100%;
}
.ele-icon-re {
  display: inline-block;
  height: 12px;
  width: 12px;
}
.ele-icon-re img {
  vertical-align: top;
  height: 100%;
  width: 100%;
}
.ele-discount-text {
  vertical-align: top;
  color: rgb(255, 255, 255);
  font-size: 10px;
  overflow: hidden;
}

.ele-discount-button {
  position: absolute;
  display: inline-block;
  color: rgb(255, 255, 255);
  top: 0;
  right: 0;
  padding: 5px 8px;
  font-size: 10px;
  line-height: 12px;
  border-radius: 16px;
  background-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-25%);
}
.ele-header-notice {
  color: rgb(255, 255, 255);
  padding: 0px 12px;
  font-size: 10px;
  background-color: rgba(7, 17, 27, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 30px;
  position: relative;
}
.ele-notice-title {
  overflow: hidden;
  display: inline-block;
  width: 22px;
  height: 12px;
  margin-top: 8px;
  background-image: url("../../assets/img/bulletin@2x.png");
  background-size: cover;
  vertical-align: top;
}
.ele-notice-text {
  margin-left: 4px;
  vertical-align: top;
}
.ele-notice-button {
  position: absolute;
  right: 2px;
}
  .ele-header-info-model{
    position: fixed;
    top: 0;
    height: 100%;
    width: 100%;
    overflow: auto;
    background-color:rgba(7,17,27,0.8);
    transition: all .2s linear;
    backdrop-filter: blur(10px);
        z-index: 999;
  }
  .ele-info-content{
    padding: 64px 36px 154px 36px;
    min-height: 100%;
    color: white;
  }
  .ele-info-closed{
    margin-top: -154px;
    display: flex;
    justify-content: center;
  }
  .ele-info-button{
    display: inline-block;
    margin: 0 auto;
    color: white;
    font-size: 32px;
  }

  .ele-info-title{
    font-size: 16px;
    font-weight: 700;
    color: rgb(255,255,255);
    line-height: 16px;
    text-align: center;
  }
  .ele-info-stars{
    margin-top: 18px;
    display: flex;
    justify-content: center;

  }

  .ele-info-divider{

    margin-top: 28px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    position: relative;
    white-space: nowrap;
  }
  .ele-info-divider::after{
    content: "";
    width: 50%;
    height: 1px;
    background-color: rgba(255,255,255,.2);

  }
.ele-info-divider::before{
  content: "";
  width: 50%;
  height: 1px;
  background-color: rgba(255,255,255,.2);

}
  .ele-model-text{
    padding: 2px 12px;
    font-size: 14px;
    font-weight: 700;
  }
  .ele-info-container{
    margin-top: 22px;
  }
  .ele-seller-notice{
    margin-top: 24px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 200;
    color: rgba(255,255,255,1);
    line-height: 24px;
  }


  .model-active-enter,.model-active-leave{
    transition: all .1s linear;
  }
  .model-enter,.model-leave-to{
    opacity: 0;
  }
</style>
